<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('车辆维修支出')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<form class="form-horizontal m" id="form-repair-edit" th:object="${cCardId}" hidden>
</form>
<div style="background-color: white">
    <a class="btn btn-info btn-outline visible-xs-block" href="#" onclick="$.modal.closeTab()">返&nbsp回</a>
</div>
<div class="container-div">
    <div class="row">
<!--        <div class="col-sm-12 search-collapse">-->
<!--            <form id="formId">-->
<!--                <div class="select-list">-->
<!--                    <ul>-->
<!--                        <li>-->
<!--                            <label>车牌号：</label>-->
<!--                            <input type="text" name="cCarid"/>-->
<!--                        </li>-->
<!--                        <li class="select-time">-->
<!--                            <label style="width: 100px">车辆维修时间：</label>-->
<!--                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[begincTime]"/>-->
<!--                            <span>-</span>-->
<!--                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endcTime]"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>车辆型号：</label>-->
<!--                            <select name="cType" th:with="type=${@dict.getType('')}">-->
<!--                                <option value="">所有</option>-->
<!--                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
<!--                            </select>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>-->
<!--                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
<!--                        </li>-->
<!--                    </ul>-->
<!--                </div>-->
<!--            </form>-->
<!--        </div>-->

        <div class="btn-group-sm" id="toolbar" role="group">

<!--            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:repair:exportrepair">-->
<!--                <i class="fa fa-download"></i> 导出-->
<!--            </a>-->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" style="color: black;font-size: 15px"> </table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('ruoyi:manages:edit')}]];
    var removeFlag = [[${@permission.hasPermi('ruoyi:manages:remove')}]];
    var prefix = ctx + "ruoyi/manages";
    var prefixs = ctx +"ruoyi/repair";
    var cCarid=[[*{cCarid}]];
    $(function() {
        var options = {
            url: prefix + "/lists/" +cCarid,
            method: 'post',
            sidePagination: "server",
            contentType: "application/x-www-form-urlencoded",
            showFooter: true,
            showColumns: false,
            modalName: "车辆维修支出列表",
            sortName:'cTime',
            sortOrder: 'desc',
            striped: true,
            columns: [
                {
                    field:'cId',
                    title:'申请人',
                    visible: false
                },
                {
                    field: 'cDepa',
                    title: '申请人部门',
                },
                {
                    field:'cPeople',
                    title:'申请人',
                },
                {
                    field: 'cPicture',
                    title: '申请人头像',
                    align: "center",
                    formatter: function(value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    //field: 'cMoney',
                    title: '维修金额',
                    formatter: function(value, row, index) {
                        var cMoney = [];
                        if(row.cMoney==null){
                            cMoney.push('￥0');
                            return cMoney.join('')
                        }else{
                            cMoney.push('￥'+row.cMoney);
                            return cMoney.join('');
                        }
                    },
                    footerFormatter:function (value) {
                        var sumcMoney = 0;
                        for (var i in value) {
                            sumcMoney += parseFloat(value[i].cMoney);
                        }
                        return "维修总金额：￥" + sumcMoney;
                    },
                },
                {
                    field: 'cData',
                    title: '维修照片',
                    align: "center",
                    formatter: function(value, row, index) {
                        return '<a href="javascript:downloadFile(\''+row.cData+'\')">下载</a>';
                    }
                },
                {
                    field: 'cTime',
                    title: '申请时间',
                },
                {
                    field: 'cRemark',
                    title: '备注',
                },
                // {
                //     title: '操作',
                //     align: 'center',
                //     formatter: function(value, row, index) {
                //         var actions = [];
                //         if(row.cMoney==null){
                //             actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="consent(\'' + row.cId + '\')"><i class="fa fa-user"></i>修改金额</a> ');
                //         }
                //         return actions.join('');
                //     }
                // }
                ]
        };
        $.table.init(options);
    });

    function downloadFile(cData) {
        window.location.href=ctx+"common/download/resource?resource="+cData;
    }
    function consent(cId) {
        $.modal.confirm("确认要修改金额吗?", function() {
            var url = prefix + '/editM/' + cId;
            $.modal.openFull("修改金额", url,100,100);
        });
    }
</script>
</body>
</html>